from PenDeployer import PenDeployer
from FileSystemDeployer import FileSystemDeployer

class DeployerManager:
    def __init__( self, wizard, outputwin, platfname, info):
        self.__wiz = wizard
        self.__platfname = platfname
        self.__deployInfo = info
        self.__outputWin = outputwin
        self.__devices = {}
        self.__createDeployers()
        self.__executeDeployers()

    def __createDeployers( self):
        if self.__deployInfo.has_key( "pen"):
            self.__devices[ "pen"] = PenDeployer( self.__wiz, self.__outputWin, self.__platfname, self.__deployInfo[ "pen"])
        if self.__deployInfo.has_key( "local"):
            self.__devices[ "filesystem"] = FileSystemDeployer( self.__wiz, self.__platfname, self.__deployInfo[ "filesystem"])

    def __executeDeployers( self):
        if len( self.__devices) > 1:
            # Show a dialog where user can set up the sequence of deployments
            return
        else:
            if self.__devices.has_key( "pen"):
                self.__devices[ "pen"].deploy()

